import Vue from 'vue'
import App from './App'

import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'
import './assets/styles/global.scss'
import router from './router'
import * as echarts from 'echarts'
import Fragment from 'vue-fragment'
import VueParticles from 'vue-particles'

Vue.use(VueParticles)
Vue.use(Fragment.Plugin)
Vue.use(ElementUI)

Vue.prototype.$echarts = echarts
Vue.config.productionTip = false

Vue.filter('dateFormat', function(originVal) {
  const dt = new Date(originVal)
  const year = dt.getFullYear()
  const month = (dt.getMonth() + 1 + '').padStart(2, '0')
  const day = (dt.getDate() + '').padStart(2, '0')
  const hour = (dt.getHours() + '').padStart(2, '0')
  const minutes = (dt.getMinutes() + '').padStart(2, '0')
  const second = (dt.getSeconds() + '').padStart(2, '0')
  return `${year}-${month}-${day} ${hour}:${minutes}:${second}`
})
Vue.filter('date', function(originVal) {
  const dt = new Date(originVal)
  const year = dt.getFullYear()
  const month = (dt.getMonth() + 1 + '').padStart(2, '0')
  const day = (dt.getDate() + '').padStart(2, '0')
  return `${year}-${month}-${day}`
})

new Vue({
  el: '#app',
  router,
  render: h => h(App)
})
